<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./styles.css">
</head>
<body>
  
  <button id="btn">展开合并</button>

  <div class="top"></div>
  <div class="bottom"></div>
</body>

<script>
  const btn = document.getElementById('btn')
  const divtop = document.querySelector('.top')
  let expand = false

  btn.addEventListener('click', () => {
    console.log('点击了')
    expand = !expand
    expand ? divtop.classList.add('more') : divtop.classList.remove('more')
  })
</script>
</html>